package com.zhu.rpc.client;

import java.util.concurrent.*;

public class RpcSendExecutor {
    private int maxThread;
    private ExecutorService executorService;
    public RpcSendExecutor(int maxThread) {
        this.maxThread = maxThread;
        int cpuCores = Runtime.getRuntime().availableProcessors();
        executorService = new ThreadPoolExecutor(cpuCores,maxThread,0, TimeUnit.MILLISECONDS,new LinkedBlockingQueue<>());
    }

    public void submit(Runnable runnable){
        executorService.submit(runnable);
    }
}
